varying vec3 vertPos;
uniform mat4 lightProjection;
uniform sampler2D lightDirs;

void main(void)
{
	int shadows = 72;
/*
	for( int w = 0; w < shadows; ++w )
	{
		for( int i = 0; i < 1; ++i )
		{
			for( int j = 0; j < 1; ++j )
			{
				float x = float(i);
				float y = float(j);

				coords = vec2( x/16.0, y/8.0);
				texel = texture2D( lightDirs, coords );
				lightVec = vec3( texel );
				lightVec = vec3( lightVec.r*2.0 - 0.5, lightVec.g*2.0 - 0.5, lightVec.b*2.0 - 0.5 );
				l = normalize( lightVec );
				
				NdotL = max(dot(n,l),0.0);
		
				R = 2.0 * NdotL * n - l;

				Id = diffuse * NdotL;
				Is = gl_FrontMaterial.specular * gl_LightSource[0].specular * pow( max( dot(R, vv), 0.0), gl_FrontMaterial.shininess );
				I += Id + Is;	
			}
		}
	}*/

    float depth = length(vertPos) / 25.0;
    gl_FragColor = vec4( depth, depth, depth, 1.0);
}